package com.menu;

import com.company.*;

import java.io.IOException;
import java.util.Scanner;

public class ArrayServerMenu {

    public void serverMenu() throws IOException {

        ArrayCRUD arrayCRUD = new ArrayCRUD();

        boolean flag = true;
        while (flag){

            System.out.println("\\n请选择服务的种类：\\n");
            System.out.println("\t1.顺序表读取文件");
            System.out.println("\t2.顺序表添加道路");
            System.out.println("\t3.顺序表查询道路信息");
            System.out.println("\t4.顺序表修改信息");
            System.out.println("\t5.顺序表删除信息");
            System.out.println("\t6.顺序表排序道路信息");
            System.out.println("\t7.转链表存储");
            System.out.println("\t0.退出");
            System.out.print("\t请选择：");

            int sc = -1;
            try{
                Scanner scanner = new Scanner(System.in);
                sc = scanner.nextInt();
            }catch (Exception e) {
                System.out.println("错误有误,请重新输入");
            }

            switch (sc){
                case 1:{
                 //   flag = false;
                    arrayCRUD.arrayReadFileToString();
                    break;
                }
                case 2:{
                    arrayCRUD.arrayInsert();
                    break;
                }
                case 3:{
                    arrayCRUD.arraySerch();
                    break;
                }
                case 4:{
                    arrayCRUD.arrayUpate();
                    break;
                }
                case 5:{
                    arrayCRUD.arrayDelete();
                    break;
                }
                case 6:{
                    SortArrayMenu sm = new SortArrayMenu();
                    sm.sortMenu();
                    break;
                }
                case 7:{
                    LinkServerMenu lsm = new LinkServerMenu();
                    lsm.linkServerMenu();
                    break;
                }
                case 0:{
                    flag = false;
                    break;
                }
                default:{
                    System.out.println("输入有误，请重新输入：");
                    break;
                }
            }
        }

    }


}
